Field of the Invention
The present invention is concerned with the creation of objects in object-oriented computer programming, and the performing of processing using the created objects.
Object-oriented computer programs are widely used for many applications. As is well known, in object-oriented programs, each respective aspect of the application with which the program is concerned is modelled as an object type. For example, referring to the field of computer graphics by way of example, typical object types include physical entities such as xe2x80x9cspherexe2x80x9d, xe2x80x9ccubexe2x80x9d etc. or models of more complex entities, such as people, made up of xe2x80x9cpolygonxe2x80x9d objects, xe2x80x9clight sourcexe2x80x9d objects to illuminate the physical entity objects and xe2x80x9ccameraxe2x80x9d objects to view the illuminated physical entity objects. Each object has associated with it attributes predefined for the object type specifying characteristics of the object. For example, typical attributes for a xe2x80x9clight sourcexe2x80x9d object referred to above are intensity and position. Processing functions are performed on the objects using the values specified for the object attributes.
Software development xe2x80x9ctool kitxe2x80x9d products are often used to create object-oriented computer programs. A software development tool kit comprises a compiled software program (that is, machine code instructions) defining a library of functions and data to be used in the creation of object-oriented programs. The functions include a respective function to create an instance of each type of object having the predefined attributes of the object type, and functions to perform processing of the thus created objects. Using a software development tool kit, a programmer can therefore include functions from the library in the tool kit in his object-oriented program to create objects and perform processing functions thereon.
One problem that exists with software development tool kits, however, is that the attributes for each type of object are predetermined by the developer of the tool kit. That is, a user of a software development tool kit product can not change the attributes associated with an instance of an object which is created using an object creation function in the tool kit. This is because the tool kit comprises compiled software (that is, machine code instructions) and the user can therefore not change the tool kit. Thus, the user of a software development tool kit cannot include processing functions in his program which require processing to be performed on an attribute not defined for an object type by the tool kit developer.
The present invention has been made with this problem in mind.
According to the present invention, there is provided an apparatus or method for object-oriented processing, in which each set of instructions for creating an instance of an object type has associated therewith an extension record, in which data can be stored to cause the creation of the object instance with an additional attribute.
According to the present invention, there is provided a computer program product for the creation of an instance of an object type having first attribute instructions for creating at least one initial attribute for the object instance, second attribute instructions for creating at least one further attribute for the object instance, extension data defining the amount of memory required for an object instance having the at least one initial attribute and the at least one further attribute together with data from which the second attribute instructions can be determined, and instructions for causing a processing apparatus to operate so that an object instance is created by reading the extension data to determine the amount of memory to allocate for the object instance, using the first attribute instructions to define the at least one initial attribute, reading the extension data to determine the second attribute instructions, and using the second attribute instructions to define the at least one further attribute.
The first attribute instructions may be provided as a separate computer program product, together with extension data for the object type defining the amount of memory required for an object instance having the at least one initial attribute and instructions for causing the extension data to be amended, upon receipt of the necessary data, to include data from which the amount of memory necessary for an object instance having the at least one initial attribute and the at least one further attribute can be determined and data from which the second attribute instructions can be determined, this separate computer program product forming another aspect of the present invention.
The extension data may be amended when the final product is run by a user, or when the product is produced by an application product developer.
The second attribute instructions may be provided as a separate computer program product together with data from which the amount of memory for the at least one further attribute can be determined, which forms a further aspect of the present invention.
The present invention further provides a computer program product having first creation instructions for the creation of an instance of an object type having at least one initial attribute, extension data defining whether or not an instance of the object type is to have any further attributes, and if so, data from which second creation instructions to create at least one further attribute can be determined, and instructions for causing the creation of an object instance in dependence upon the first creation instructions and any further creation instructions defined in the extension data.
The first creation instructions may be provided together with initial extension data including a list for storing data from which further creation instructions can be determined as a separate computer program product, which forms a further aspect of the present invention.
The further creation instructions may also be provided along with data from which the size of the at least one further attribute can be determined as a separate computer program product, which also forms an aspect of the present invention.